home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1997 / MacHack 1997.toast / Hacks / Hacks ’96 / Booting Gallery / Booting Gallery (source) / (Libraries) / Sound Streaming / Transmitter.h < prev   
Encoding:
Text File  |  1996-06-22  |  1.3 KB  |  70 lines  |  [TEXT/BROW]

  1. // Transmitter.h
  2. // Created by Bill Hubauer on Fri, Jun 16, 1995 @ 7:27 AM.
  3.  
  4. #ifndef __Transmitter__
  5. #define __Transmitter__
  6.  
  7. #ifndef __MessageObjects__
  8. #include "MessageObjects.h"
  9. #endif
  10.  
  11. #ifndef __SSTYPES__
  12. #include "SSTypes.h"
  13. #endif
  14.  
  15. #ifndef __SoundSource__
  16. #include "SoundSource.h"
  17. #endif
  18.  
  19. #ifndef __Semaphore__
  20. #include "Semaphore.h"
  21. #endif
  22.  
  23.  
  24.  
  25. class STransmitter : public MMessageReceiver
  26. {
  27. public:
  28.     STransmitter(SSWriteProcPtr    writeProc,long writeProcRefCon,SSQuality quality);
  29.     virtual ~STransmitter();
  30.     
  31.     OSErr    Initialize();
  32.     
  33.     
  34.     OSErr    SetSource(SSoundSourceRef    newSource);
  35.     SSoundSourceRef    GetSource()        {return _curSource;}
  36.     void    SetActive(Boolean    activeQ);
  37.     Boolean    ActiveQ()            {return _activeQ;}
  38.     void    Reset()                {_curSource->Reset();}
  39.     
  40.     
  41.     virtual void    ReceiveMessage(UInt32    message,void* param,MMessageSender* from);
  42.  
  43. private:
  44.     void        KillWriteBuffer();
  45.     void        WaitForWriteToComplete();
  46.     OSErr        MakeNewWriteBuffer();
  47.     
  48.     void        StartWrite();
  49.     
  50.     void        CompleteWrite(OSErr ioResult);
  51.     static pascal void WriteCompletion(long completionData,OSErr    ioResult,long ioLength);
  52.  
  53.  
  54.     SSoundSourceRef        _curSource;
  55.     Boolean                _activeQ;
  56.     Boolean                _priming;
  57.     
  58.     Ptr                    _writeBuffer;
  59.     UInt32                _bufferSize;
  60.     
  61.     SSWriteProcPtr        _writeProc;
  62.     long                _writeProcRefCon;
  63.     SSQuality            _quality;
  64.     
  65.     CSemaphore            _writeFlag;
  66.     OSErr                _sourceError;
  67. };
  68.  
  69. #endif
  70.